<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Proveedores filter form base class.
 *
 * @package    tercermilenio
 * @subpackage filter
 * @author     Your name here
 */
class BaseProveedoresFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'pvd_nro_documento' => new sfWidgetFormFilterInput(),
      'pvd_nombre'        => new sfWidgetFormFilterInput(),
      'pvd_direccion'     => new sfWidgetFormFilterInput(),
      'pvd_localidad'     => new sfWidgetFormPropelChoice(array('model' => 'Localidades', 'add_empty' => true)),
      'pvd_telefono'      => new sfWidgetFormFilterInput(),
      'pvd_celular'       => new sfWidgetFormFilterInput(),
      'pvd_mail'          => new sfWidgetFormFilterInput(),
      'pvd_estado'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'pvd_nro_documento' => new sfValidatorPass(array('required' => false)),
      'pvd_nombre'        => new sfValidatorPass(array('required' => false)),
      'pvd_direccion'     => new sfValidatorPass(array('required' => false)),
      'pvd_localidad'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Localidades', 'column' => 'loc_id')),
      'pvd_telefono'      => new sfValidatorPass(array('required' => false)),
      'pvd_celular'       => new sfValidatorPass(array('required' => false)),
      'pvd_mail'          => new sfValidatorPass(array('required' => false)),
      'pvd_estado'        => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('proveedores_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Proveedores';
  }

  public function getFields()
  {
    return array(
      'pvd_id'            => 'Number',
      'pvd_nro_documento' => 'Text',
      'pvd_nombre'        => 'Text',
      'pvd_direccion'     => 'Text',
      'pvd_localidad'     => 'ForeignKey',
      'pvd_telefono'      => 'Text',
      'pvd_celular'       => 'Text',
      'pvd_mail'          => 'Text',
      'pvd_estado'        => 'Text',
    );
  }
}
